home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Technotools
/
Technotools (Chestnut CD-ROM)(1993).ISO
/
misc_pto
/
bmacs
/
markword.cb
< prev
next >
Wrap
Text File
|
1991-03-19
|
780b
|
41 lines
//
// mark_word_at_cursor by Luigi M. Bianchi 03/19/91
//
// expects: nothing
// returns: nothing
//
// marks word at cursor; displays error message if there is no word
//
// a word is defined here as any combination of [_A-Za-z0-9]
// not starting with a digit
void mark_word_at_cursor ()
{
int col1, col2;
int gotit;
string word;
gotit = search_back ("[ \t]|[~A-Za-z_]");
if (gotit)
next_char (1);
else
move_abs(NULL,1);
inq_position (NULL,col1);
search_fwd ("[ \n\t]|[~0-9A-Za-z_]");
prev_char (1);
inq_position (NULL, col2);
word = trim (read (col2 - col1 + 1));
if (word == "")
error("No word at cursor");
else
{
move_abs (NULL, col1);
drop_anchor(1);
move_abs(NULL,col2);
}
}